<template>
    <div class="left_menu">
       <ul>
           <li v-for="(item,index) in tabs" :class="{active: showactive ==item.categoryname }" :key="index"  @click="transferindex(index)"><a>{{item.categoryname}}</a></li>
       </ul>
    </div>
</template>

<script>
export default {
  props: ["tabs"],
  data() {
    return {
      showactive: "热门推荐"
    };
  },
  //生命周期 - 创建完成（访问当前this实例）
  created() {},
  methods: {
    //传递左侧点击菜单的索引index
    transferindex(index) {
      //console.log(index)
      this.showactive = this.tabs[index].categoryname;
      this.$emit("transfer-index", index);
    }
  }
};
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>